/******************************************************************************
*  COPYRIGHT MorningCore CO.,LTD
******************************************************************************/

/*****************************************************************
 * FileName::    RSGen.c
 * version::     1.0.0
 * Purpose:      Cyclic shifted sequence generation for PUSCH DMRS
 * Authors:      shanshan, 2022-11-28
 * Notes:        None
 ******************************************************************/



/******************************************************************************
*  HISTORY OF CHANGES
*   <Date>          <Author>        <Version>       <DESCRIPTION>
*   2022-11-28      shanshan       V0.0.1           original
******************************************************************************/

/******************************************************************************
*  INCLUDE FILES
******************************************************************************/
#include "../head/ue_tx_pusch_rsgen_fix.h"
/*----------- function definition-----------------------------------*/
/*****************************************************************************
* Function: RSGen_PUSCH()
* Purpose:  This function performs cyclic shift sequence generation for PUSCH DMRS,
* Relation:
Calls       : ....
Called by   : ....
* Params:
*   <Name>                  <Type>      <In/Out>    <Description>
*   RSGen_Op[1320]          cmplx_frN   Out         output of RSGen for PUSCH
  * Return:  void
  * Note:    None
*******************************************************************************/
void RSGen_PUSCH_fix
(
    IN stULParamTable *SimParam,
    IN int  BitLen,
    OUT cmplx_frN   *RSGen_Op[RS_NUM_PER_TTI_UL]// output of RSGen
)
{
    uint32 uwCInit = 0; // init for x2
    int u16_m = 0;
    int8  DMRS_SybmNumPer_TTI = SimParam->DMRS_NumInOneSlot;
    int8  PUSCH_DMRS_Group = SimParam->PUSCH_DMRS_Group;
    int   N_Symb_Slot = 0;

    for (u16_m = 0; u16_m < DMRS_SybmNumPer_TTI; u16_m++) // symbol by symbol
    {
        RSGen_fix_ReleaseFlag(
            SimParam->PUSCH_RB_Num,                 // number of sub-carriers of RS
            0,                      // Cyclic shift param in 3GPP TS 38.211
            0,                      // Omiga in 3GPP TS 38.211
            1,                      // Delta in 3GPP TS 38.211
            SimParam->PUSCH_DMRS_uIdx[u16_m],                       // u in 3GPP TS 38.211
            SimParam->PUSCH_DMRS_vIdx[u16_m],                       // v in 3GPP TS 38.211
            0,           // alpha = 2*pi*Ncs/12 for DMRS-0; alpha = 2*pi*Ncs/8 for SRS-1
            0,
            BitLen,
            RSGen_Op[u16_m]           // output of RSGen
        );
    }

}